<template>
  <div class="school">
    <h2>学校姓名：{{name}}</h2>
    <h2>学校地址：{{address}}</h2>
    <button @click="sendSchoolName">点我将学校名传给App</button>
  </div>
</template>

<script>
    export default {
        name: "School",
      data(){
          return{
            name:"幸福中学",
            address:"北京市海淀区"
          }
      },
      methods:{
        sendSchoolName(){
          this.$emit("sName",this.name)
        }
      }
    }
</script>

<style scoped>
.school{
  background-color: pink;
}
</style>
